package m.jclecai.com.fragment.klpk.pager;

import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;


import java.util.ArrayList;

import m.jclecai.com.R;
import m.jclecai.com.bean.klpk.bean.PokerBean;
import m.jclecai.com.view.klpk.PagerRecyclerAdapter;
import m.jclecai.com.view.klpk.Poker;

/**
 * Created by andy on 2017/6/6.
 * 同花
 */

public class SameColorFragment extends BasePagerFragment {

    @Override
    protected ArrayList<ArrayList<PokerBean>> initData() {

        setIndex(1);
        setItemAward(90);
        setSelectAllAward(22);

        mTvSelectedAllRules.setText(getSelectedAllRichText("任选花色,只要开出同花即中奖22元"));

        ArrayList<ArrayList<PokerBean>> mListData = new ArrayList<>();


        //这里的话，我们就需要设置相应的布局了
        PokerBean pokerBeanSpades = new PokerBean(PokerBean.Category.spades, 1);
        ArrayList<PokerBean> fourthPoker = new ArrayList<>();
        fourthPoker.add(pokerBeanSpades);
        mListData.add(fourthPoker);


        PokerBean pokerBeanHearts = new PokerBean(PokerBean.Category.hearts, 1);
        ArrayList<PokerBean> thirdPoker = new ArrayList<>();
        thirdPoker.add(pokerBeanHearts);
        mListData.add(thirdPoker);

        //这里的话，我们就需要设置相应的布局了
        PokerBean pokerBeanPlum = new PokerBean(PokerBean.Category.pulm_blossomm, 1);
        ArrayList<PokerBean> secondPoker = new ArrayList<>();
        secondPoker.add(pokerBeanPlum);
        mListData.add(secondPoker);


        //这里的话，我们就需要设置相应的布局了
        PokerBean pokerBeanBox = new PokerBean(PokerBean.Category.box, 1);
        ArrayList<PokerBean> firstPoker = new ArrayList<>();
        firstPoker.add(pokerBeanBox);
        mListData.add(firstPoker);

        return mListData;
    }

    @Override
    public PagerRecyclerAdapter getMyAdapter() {
        return new MyAdapter(mListData);
    }

    @Override
    public RecyclerView.LayoutManager getLayoutManager() {
        return new GridLayoutManager(getActivity(), 4) {
            @Override
            public boolean canScrollVertically() {
                return false;
            }
        };
    }

    public class MyAdapter extends PagerRecyclerAdapter {

        public MyAdapter(ArrayList<ArrayList<PokerBean>> listData) {
            super(listData);
        }

        @Override
        protected int getPokerCategory() {
            return Poker.TYPE_SAME_COLOR;
        }

        @Override
        public int getItemLayout() {
            return R.layout.item_poker_same_color;
        }
    }

    @Override
    public String getSelectAllTitle() {
        return "同花包选";
    }
}
